#include <iostream>
#include <vector>
using namespace std;

pair<int,int> f(vector<int>& arr, int v)
{
	int left = 0, right = arr.size() - 1;
	pair<int, int> ret;
	while (left < right)
	{
		int mid = left + (right - left) / 2;
		if (arr[mid] < v) left = mid + 1;
		else right = mid;
	}
	ret.first = left;

	left = 0;
	right = arr.size() - 1;
	while (left < right)
	{
		int mid = left + (right - left + 1) / 2;
		if (arr[mid] <= v) left = mid;
		else right = mid - 1;
	}
	ret.second = left;
	return ret;
}

int main()
{
	vector<int> arr = { 1,1,2,2,2,3,3,4,4,4,5,5 };
	pair<int, int> ret;
	ret = f(arr, 4);
	cout << ret.first << ' ' << ret.second << endl;
	return 0;
}